package testing;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.BitSet;


public class ReadFromFile {
	
	public static void main(String[] args){
		File f = new File("C:" + File.separator + "Users"
				+ File.separator + "Bhavya" + File.separator + "Desktop"
				+ File.separator + "java_for_cloudcomputing" + File.separator
				+ "java_code" + File.separator + "Sample.doc.txt");
		byte[] b = new byte[1024] ;
		ArrayList<BitSet> sourceBits = new ArrayList<BitSet>();
		try {
			RandomAccessFile r = new RandomAccessFile(f, "r");
			long new_pos=0;
			int i=0;
			while(new_pos!=r.length()){
				i++;
				r.read(b ,0, 1024 );
				System.out.println(new String(b));
				new_pos=1024*i;
				r.seek(new_pos);
				sourceBits.add(BitSet.valueOf(b));
			}
			r.close();
			
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

}
